package work20241207_chap8.l;



/**
 * @author zdl
 * @date 2024/12/3
 */
public class Magicer extends NameRole implements Role {
    private int level;
    private MagicStick stick;

    public MagicStick getStick() {
        return stick;
    }

    public void setStick(MagicStick stick) {
        this.stick = stick;
    }

    public Magicer() {
    }

    public Magicer(int level) {
        this.level = level;
    }



    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        if (level >= 1 && level <= 10) {
            this.level = level;
        } else {
            System.out.println("魔法等级在1-10之间");
        }
    }

    @Override
    public int attack() {
        int magNum = 5;
        return magNum * level;
    }

    @Override
    public void practise() {

        if (stick ==null){
            level++;
        }else {
            level = level + 1 + stick.fire();
        }
    }


}
